# encoding: utf-8
# @File  : run_jenkins.py
# @Author: wu shaofan
# @Date  :  2024/04/18
# @Desc : 在jenkins中运行框架的脚本
import sys
sys.path.append('/var/jenkins_home/python3/lib/python3.8/site-packages')
sys.path.append('/var/jenkins_home/workspace/TPshop_webdemo/TPshop_webdemo_pro')

import subprocess
import config
from Utils.set_allure_environment import set_report_xml_on_results


class Report:
    def init_run(self):
        cmd = f'pytest -sv --alluredir={config.allure_html_report_url}   --clean-alluredir'
        subprocess.call(cmd, shell=True)


if __name__ == '__main__':
    obj01 = Report()
    obj01.init_run()

    # 生成environment.xml放到allure_html文件中
    set_report_xml_on_results(config.allure_html_report_url)
